:root {
  --border: #d7dbe0;
  --bg-panel: #f7f8fa;
  --accent: #1a56db;
  --accent-hover: #1442a8;
}
* { box-sizing: border-box; }
body {
  font-family: Segoe UI, Arial, sans-serif;
  margin: 0;
  padding: 24px;
  background: #ffffff;
  color: #1f2328;
}
h1 {
  font-size: 20px;
  margin: 0 0 4px 0;
}
p.subtitle {
  margin: 0 0 20px 0;
  color: #57606a;
  font-size: 13px;
}
.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .preview-col { position: static; max-height: none; }
}
.preview-col {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--bg-panel);
}
.panel h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #57606a;
  margin: 0 0 10px 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.panel h2.no-top-border {
  padding-top: 0;
  border-top: none;
}
label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin: 10px 0 4px 0;
}
input, select {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.date-field, .time-field {
  display: flex;
  gap: 6px;
  align-items: center;
}
.date-field input, .time-field input { flex: 1; min-width: 0; }
.tbd-btn, .date-toggle-btn, .time-toggle-btn {
  padding: 6px 8px;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}
.date-toggle-btn, .time-toggle-btn {
  font-size: 14px;
  padding: 6px 9px;
}
.auto-field {
  background: #eceef1;
  color: #57606a;
}
.auto-field:focus {
  background: #fff;
  color: #1f2328;
}
.input-error {
  border-color: #cf222e !important;
  background: #fff0f0 !important;
  transition: border-color .15s, background .15s;
}
.date-invalid {
  border-color: #cf222e !important;
  background: #cf222e !important;
  color: #fff !important;
}
.date-invalid::placeholder { color: #ffd9d9; }
.date-warning-banner {
  margin-top: 10px;
  color: #cf222e;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}
.booking-type-toggle {
  display: flex;
  gap: 10px;
}
.booking-type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #f7f8fa;
  color: #9aa0a6;
  font-size: 13.5px;
  font-weight: 600;
}
.booking-type-btn:hover { background: #eef1f4; }
.booking-type-btn.selected {
  background: #eaeefc;
  border-color: var(--accent);
  color: var(--accent);
}
.booking-type-icon {
  font-size: 16px;
  position: relative;
  top: -2px;
}
#pickerPopup {
  position: absolute;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  padding: 16px 18px;
  display: none;
  font-size: 12.5px;
}
#pickerPopup.open { display: block; }
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cal-header .cal-title {
  font-size: 16px;
  font-weight: 700;
  color: #1f2328;
}
.cal-header .cal-nav { display: flex; flex-direction: row; gap: 6px; }
.cal-header .cal-nav button {
  background: none;
  border: 1px solid var(--border);
  color: #57606a;
  width: 28px;
  height: 24px;
  font-size: 12px;
  line-height: 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-header .cal-nav button:hover {
  background: #eef3ff;
  color: var(--accent);
  border-color: var(--accent);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  width: 300px;
}
.cal-grid .cal-dow {
  text-align: center;
  font-size: 11px;
  color: #57606a;
  font-weight: 700;
  padding: 4px 0 8px 0;
}
.cal-grid button.cal-day {
  background: #fff;
  border: none;
  color: #1f2328;
  padding: 9px 0;
  font-size: 13.5px;
  border-radius: 50%;
  font-weight: 500;
  aspect-ratio: 1 / 1;
}
.cal-grid button.cal-day:hover { background: #eef3ff; }
.cal-grid button.cal-day.cal-adjacent { color: #b3b9c1; }
.cal-grid button.cal-day.cal-today:not(.cal-selected) {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.cal-grid button.cal-day.cal-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.time-wheel {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  width: 220px;
}
.time-wheel-col {
  display: flex;
  flex-direction: column;
}
.time-wheel-cell {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  color: #1f2328;
  cursor: pointer;
}
.time-wheel-cell:hover:not(.time-wheel-selected) { background: #eef3ff; }
.time-wheel-cell.time-wheel-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.time-wheel-cell.time-wheel-empty { cursor: default; }
.checkbox-row-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.checkbox-row-group .checkbox-row {
  margin: 4px 0;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 8px 0;
}
.checkbox-row input {
  width: auto;
  margin: 0;
}
.checkbox-row:has(input:disabled) {
  opacity: .5;
}
.conditional-section {
  border-left: 2px solid var(--border);
  padding-left: 10px;
  margin-bottom: 4px;
}
.leg-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fff;
}
.leg-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #57606a;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.remove-leg-btn {
  background: none;
  border: none;
  color: #cf222e;
  font-size: 16px;
  font-weight: 700;
  padding: 0 4px;
  line-height: 1;
}
.remove-leg-btn:hover { color: #a40e26; }
#addLegBtn { width: 100%; margin-top: 2px; }
.preview-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}
button:hover { background: var(--accent-hover); }
button.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button.secondary:hover { background: #eef3ff; }
.subject-line {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  font-size: 13px;
  margin-bottom: 12px;
}
.subject-line span.label {
  font-weight: 700;
  margin-right: 4px;
}
#preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  background: #fff;
  font-family: "Aptos", Calibri, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  min-height: 300px;
}
#preview strong, #preview b {
  font-family: "Aptos (Bold)", "Aptos", Calibri, Arial, sans-serif;
  font-weight: bold;
}
#preview p { margin: 0 0 10px 0; }
#preview ul { margin: 0 0 10px 0; padding-left: 22px; }
#preview ul ul { margin: 0; padding-left: 20px; }
#preview li { margin: 0; }
.copied-msg {
  font-size: 12px;
  color: #1a7f37;
  font-weight: 600;
  align-self: center;
  visibility: hidden;
}
.hint {
  font-size: 11.5px;
  color: #57606a;
  margin-top: 2px;
}
